Skip to content

cmake: Avoid using target_properties for old cmake - #3845

Merged
yanesca merged 1 commit into
Mbed-TLS:developmentfrom
d3zd3z:fix3801
Nov 5, 2020
Merged

yanesca merged 1 commit into
Mbed-TLS:developmentfrom
d3zd3z:fix3801

Conversation

@d3zd3z

@d3zd3z d3zd3z commented Nov 3, 2020 •

Copy link
Copy Markdown
Contributor

CMake versions less than 3.0 do not support the target_sources
command. In order to be able to support v2.8.12.2 of cmake, directly
set the SOURCES property instead of using the target_sources command.

A future patch could reverse this, if the project decides to forgo
support for cmake versions less than 3.0.

Fixes #3801

Signed-off-by: David Brown david.brown@linaro.org

Status

READY/

Requires Backporting

Yes 2.16

Migrations

If there is any API change, what's the incentive and logic for it.

NO

Additional comments

Any additional information that could be of interest

Todos

  • Tests
  • Documentation
  • Changelog updated
  • Backported

Backport to 2.16: #3851

Steps to test or reproduce

Build using cmake 2.8.12.2.

CMake versions less than 3.0 do not support the `target_sources`
command.  In order to be able to support v2.8.12.2 of cmake, directly
set the SOURCES property instead of using the target_sources command.

A future patch could reverse this, if the project decides to forgo
support for cmake versions less than 3.0.

Fixes Mbed-TLS#3801

Signed-off-by: David Brown <david.brown@linaro.org>
@d3zd3z

d3zd3z commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

This is a direct translation of the target_sources command to work with older versions of cmake. Some of this could be done by just adding the source directly to the target, but others this is cleaner.

This is admittedly a bit messy, but necessary if we wish to continue supporting v2.8.12.2 (Centos 7) of cmake.

@yanesca yanesca added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Nov 4, 2020

@yanesca yanesca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@ronald-cron-arm ronald-cron-arm added the needs-backports Backports are missing or are pending review and approval. label Nov 4, 2020
@ronald-cron-arm

Copy link
Copy Markdown
Contributor

There are calls to target_sources in 2.16, we need to fix those as well I guess. Thus added "needs: backports" label .

@ronald-cron-arm ronald-cron-arm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I like this solution with a direct and systematic replacement for target_sources().

@yanesca yanesca added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review needs-backports Backports are missing or are pending review and approval. labels Nov 5, 2020
@yanesca
yanesca merged commit 46f3584 into Mbed-TLS:development Nov 5, 2020
@d3zd3z

d3zd3z commented Dec 4, 2020

Copy link
Copy Markdown
Contributor Author

Unfortunately, this still doesn't fix the builds for Cmake 2.8.12. See #3897. It appears that in the old cmake, this target sources property is read only. The workaround for that involves changing how the targets are built up, since we need to know all of the sources by the time we reach that target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Design and code approved - may be waiting for CI or backports

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmake 3.19 will be a problem for mbedtls

3 participants